import { Category } from 'src/category/entities/category.entity';
import {
  BaseEntity,
  Column,
  Entity,
  ManyToOne,
  PrimaryGeneratedColumn,
} from 'typeorm';

@Entity()
export class Goods extends BaseEntity {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column()
  mainImg: string;

  @Column()
  price: number;

  @Column()
  description: string;

  @Column()
  isShow: boolean;
  @Column()
  create_time: Date;
  @Column()
  update_time: Date;
  @Column({ nullable: true })
  delete_time: Date;

  @ManyToOne(() => Category, (category) => category.goods)
  category: Category;
}
